home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / TESTFIND.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  1.3 KB  |  66 lines

  1. /* testfind.c - test viewfind.c (move_forward & move_backward) */
  2. #include "stdio.h"
  3. extern long top_of_page  ;
  4. long pos  ;
  5.  
  6.  
  7. main()
  8.   {
  9.      int c  ;
  10.      int n  ;
  11.      char s[81]  ;
  12.  
  13.      printf("\n testing set_top_page \n")  ;
  14.      top_of_page = -999l  ;
  15.      pos = 7  ;
  16.      printf("\n before call - top_of_page = %1d",top_of_page)  ;
  17.      set_top_page()  ;
  18.      printf("\n after  call - top_of_page = %1d",top_of_page)  ;
  19.      printf("\n")  ;
  20.  
  21.  
  22.  
  23.      printf("\n test move_forward ")  ;
  24.      while( 1 == 1 )
  25.         {  printf("\n nlines:") ; scanf("5d",&n)  ;
  26.            if ( n < 0 )
  27.               break  ;
  28.            move_forward(n)  ;
  29.            printf("\n top_of_page = %1d",top_of_page) ;
  30.         }
  31.  
  32.  
  33.      printf("\n test move_backward ")  ;
  34.      while( 1 == 1 )
  35.         {  printf("\n nlines:") ; scanf("%1d",&n)  ;
  36.            if( n < 0 )
  37.               break  ;
  38.            move_backward(n)  ;
  39.            printf("\n top_of_page = %1d",top_of_page)  ;
  40.         }
  41.   }
  42.  
  43.  
  44.  
  45.   get_next_char()
  46.   {
  47.      int c  ;
  48.      printf("\n get_next_char  called")  ;
  49.      pos = pos + 1  ;
  50.      printf("  - return(decimal):")  ;
  51.      scanf("%d",&c)  ;
  52.      return(c)  ;
  53.   }
  54.  
  55.   move_to(p)
  56.   long p  ;
  57.   {
  58.      pos = p  ;
  59.      printf("\n move_to called - position + %1d",pos)  ;
  60.   }
  61.  
  62. long where_now()
  63.   {
  64.       return( pos )  ;
  65.   }
  66.